home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-04-12 | 1.9 KB | 45 lines | [TEXT/GEOL] |
- Item 5768606 11-April-89 16:39
-
- From: ROLLIN1 Rollin, Keith A.
-
- To: MACAPP.TECH$ MACAPP Tech
-
- Sub: MPW 3.0 Pascal Bug
-
- To: All MacApper's
-
- Pascal Bug update:
-
- We've recently identified a new bug in the MPW 3.0 Pascal compiler. I am
- posting it to MacApp.Tech$ because it is a bug that will especially affect
- Object Pascal programmers.
-
- Under the right circumstances, an internal temporary reference to the current
- object will be lost, and valid access to your temporary variables will be lost.
- These circumstances occur when you are using objects compiled with the MC68881
- option and you call a procedure between the time you store some values into
- your instance variables and the time you access them later. Roberts Penland and
- Castillo noticed this under several circumstances, specifically this one:
-
- fStart:=((12500000.0/4096.0)*224.0)/(128.0*1024.0);
- fStop:=((12500000.0/4096.0)*448.0)/1024.0;
- fLogStart:=Log2(((12500000.0/4096.0)*224.0)/(128.0*1024.0));
- writeln('start =',fStart,'stop =',fStop,'logstart =',fLogStart);
-
- In this case, Real values are generated and stored into fStart, fStop, and
- fLogStart, which are instance variables for the object we are in. When Pascal
- generates the code to store the values into the object, it dereferences the
- object handle stored in A4 and puts the pointer into A0. This pointer in A0 is
- used to store and retrieve the instance variable values. Later, when the
- writeln is executed, A0 is trashed before the values of fStart, fStop, and
- fLogStart can be retrieved. This causes the incorrect values to be retrieved.
-
- The cause of this bug has been identified, and will be fixed in the next
- release of MPW. In the meantime, either test your code in non-68881 mode, or
- store your instance variables in temporary locals if you need them across
- procedure calls.
-
- - Keith Rollin
- - Apple Developer Technical Support
-
-